<?php
	
	if(!isset($_SESSION['language'])) {
		$_SESSION['language'] = 'EN';
	}
	
	function getLocalizedText($page) {
		$text = array();
		$lang = $_SESSION['language'];
		
		$localisedFileName = "org/kahikai/translation/$page.$lang";
		if(!file_exists($localisedFileName)) {
			$localisedFileName = "org/kahikai/translation/$page.EN";
		}
		$lines = file($localisedFileName, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
		foreach ($lines as $line) {
			$chunks = explode('=', $line);
			$text[$chunks[0]] = $chunks[1];
		}
		
		return $text;
	}
?>